﻿using AutoCreateMapAndRoad.MapFolder.VisitorFolder;
using Microsoft.Xna.Framework;
using System;

namespace AutoCreateMapAndRoad.MapFolder.Elements
{
    public class KhoiI : DoanDuong
    {
        int dodai;
        string huong;
        Random rand;

        public KhoiI(string huong = "z")
        {
            rand = new Random();
            dodai = rand.Next(4, 5);
            if (Map.curPosi.Y == 0 || Map.curPosi.X == 0 || Map.curPosi.X == Map.SizeOfMatrix.X - 1) this.huong = "phai";
            else
            {
                if (huong.Equals("z"))
                {
                    int temp = rand.Next(3000) % 4;
                    if (temp == 0) this.huong = "tren";
                    if (temp == 1) this.huong = "duoi";
                    if (temp == 2 || temp == 3) this.huong = "phai";
                }
                else
                {
                    this.huong = huong;
                }
            }
        }
        public void accept(Visitor visitor)
        {
            visitor.visit(this);
        }
        public string getHuong()
        {
            return huong;
        }
        public int getDodai()
        {
            return dodai;
        }
    }
}
